home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 058 (1988-05-15)(Ossowski, Stefan)(DE)(PD).zip / Taifun 058 (1988-05-15)(Ossowski, Stefan)(DE)(PD).adf / AntiVirus / AntiVirus.asm < prev    next >
Assembly Source File  |  1988-04-21  |  8KB  |  289 lines

  1. ; AntiVirus  by  HEIKO RATH
  2. ;
  3. ;    -=>A very short hack to check and reset the 3 ResetPointers
  4. ;            (Cold-, Cool- and WarmCapture)
  5. ;
  6. ; Once upon a time I was sitting in front of my Amiga and inserted a new
  7. ; Public Domain Disk when suddenly a message in a red box apeared. The
  8. ; message was like this:
  9. ;
  10. ;    Something wonderful has happened. Your Amiga is alive !!!
  11. ;    A and even better ... Some of your Disks are infected by
  12. ;    a VIRUS !!! Another masterpiece of the Mega Mighty SCA !!
  13. ;
  14. ; At first I was shocked, but then I started to defeat the Virus from my
  15. ; Bootblocks. It is a rather harmless thing, the only damage it is able
  16. ; to do is to destroy/alter your bootblocks. But it is possible that another
  17. ; Virus might not be as harmless as the SCA-Virus. So I wrote a little toy to
  18. ; prevent my machine from being hurt by a resetresident Virus. The only
  19. ; thing it does is to check, report and reset your Resetpointers 'cause
  20. ; I think this is the usual way a Virus does it's dirty work. For the best
  21. ; results possible I use it in my startup-sequence & Shellstartup-sequence.
  22. ; This little program only works in the CLI environment. If all 3 vectors
  23. ; point to $00000000 then everything is OK (at least these are the default
  24. ; values). To force AntiVirus to clear the pointers enter "AntiVirus c".
  25. ;
  26. ; I used Asm68k and Blink6.7 to assemble and link it.
  27. ;
  28. ;        !!!!!!!!COPY ME I WANT TO TRAVEL!!!!!!!!
  29. ;
  30. ; This program is public domain. Feel free to copy and modify it. If you
  31. ; like it you can do one of the following things:
  32. ;
  33. ; 1.    absolutly nothing
  34. ; 2.    send me something I deserve:
  35. ;                money, yachts, beer, Marabu chocolate
  36. ; 3.    contact us
  37. ;
  38. ;                Heiko Rath
  39. ;                Raiffeisenstr.10a
  40. ;                D-6108 Weiterstadt
  41. ;                WEST GERMANY
  42. ;                Tel.06150-2658
  43. ;
  44. ;                                     or
  45. ;
  46. ;                          
  47. ;______  /          
  48. ;______\O                    - The Software Brewery - 
  49. ;      \\                          
  50. ;       o            Sparkling, fresh software from W.-Germany
  51. ;                 
  52. ;     @@@@@          Straight from the bar to your Amiga
  53. ;     |~~~|\        
  54. ;     | | |/        
  55. ;     |___|        With our regards to the Software Distillery
  56. ;
  57. ;Members are (listed alphabetically):
  58. ;Christian Balzer alias <CB>, Lattice C, user interfaces, beer addict. 
  59. ;Christof Bonnkirch, Aztec C, telecommunications, money adict.
  60. ;Heiko Rath alias <HR>, Assembler, ROM-Kernal stuff, Marabou addict. 
  61. ;Peter Stark alias PS, Lattice C, IO & utilities, WordStar addict.
  62. ;Ralf Woitinas alias RAF, Assembler, anything, Ray-Tracing addict.
  63. ;Torsten Wronski alias MM, Assembler, anything, girls addict.
  64. ;
  65. ;Beverages: Altenmuenster Brauer Bier, Urfraenkisches Landbier, Grohe Bock.
  66. ;
  67. ;Send exotic drinks, $$$$, comments, critizism, flames to:
  68. ;
  69. ;The Software Brewery
  70. ;Christian Balzer
  71. ;Im Wingertsberg 45
  72. ;D-6108 Weiterstadt
  73. ;West-Germany
  74. ;
  75. ;Our BBS "AmigaNode" isn't online yet. As soon as it becomes available, 
  76. ;you'll be the first to know :-).
  77. ;
  78. ;
  79. ;
  80. ; Thanks to Larry Phillips, (CIS - 76703,4322) for his binhexroutine!!! 
  81. ; Note to Leo Schwab: keep on developing display hacks!!!
  82. ;
  83. ; Remember:
  84. ;+--------------------------------------------------------------------+
  85. ; A clean, neat, and orderly work place is a sure sign for a sick mind  :-)
  86. ;+--------------------------------------------------------------------+
  87. ;
  88.  
  89. ExecBase    Equ    4
  90.  
  91. ;
  92. ; Exec Offsets:
  93. ;
  94. OpenLibrary    Equ    -552        ;OpenLibrary (LibName,version)(a1,d0)
  95. CloseLibrary    Equ    -414        ;CloseLibrary (Library)(a1)
  96. ColdCapture    Equ    $2a
  97. CoolCapture    Equ    $2e
  98. WarmCapture    Equ    $32
  99.  
  100. ;
  101. ; DOS Offsets:
  102. ;
  103. OutPut        Equ    -60        ;OutPut ()
  104. Write        Equ    -48        ;Write (file,buffer,length)(d1,d2,d3)
  105.  
  106. run:
  107.     SUBQ.W    #$1,D0                ;Byte-count -1
  108.     BEQ.S    OpenDos                ;no Parameters? -=> OpenDos
  109.  
  110. search:
  111.     CMPI.B    #$20,(A0)+            ;search for argument
  112.     BNE.S    found                ;-=>found
  113.     DBF    D0,search            ;
  114.     BRA.S    OpenDos                ;not found
  115.  
  116. found:
  117.     MOVE.B    -(A0),D0            ;move argument to d0
  118.     ANDI.B    #$DF,D0                ;convert 'c'-=> 'C'
  119.     CMPI.B    #$43,D0                ;is it 'C'?
  120.     BNE.S    OpenDos                ;no -=> OpenDos
  121.     MOVE.L    D0,Flag                ;set Flag
  122.  
  123. OpenDos:
  124.     MOVEA.L    ExecBase,A6            ;Execaddress to a6
  125.     MOVEA.L    #DOSNAME,A1            ;Librarynamepointer to a1
  126.     MOVEQ.L    #$0,D0                ;any version
  127.     JSR    OpenLibrary(A6)            ;try to open DOS-Library
  128.     TST.L    D0                ;is d0 = NULL?
  129.     BEQ    ErrorExit            ;exit if call wasn't successfull
  130.  
  131.     MOVE.L    D0,DOSBase            ;save DOSBasepointer
  132.     MOVEA.L    D0,A6                ;move DOSBasepointer to a6
  133.     JSR    OutPut(A6)            ;identify the initial output handle
  134.     MOVE.L    D0,stdout            ;save stdout
  135.  
  136.     MOVEA.L    ExecBase,A6            ;Execaddress to a6
  137.     MOVE.L    ColdCapture(A6),D0        ;ColdCapture to d0
  138.     MOVEA.L    #COLD,A0            ;#COLD to a0
  139.     BSR    binhex                ;convert Hex to ASCII -=> COLD
  140.     MOVE.L    CoolCapture(A6),D0        ;CoolCapture to d0
  141.     MOVEA.L    #COOL,A0            ;#COOL to a0
  142.     BSR.B    binhex                ;convert Hex to ASCII -=> COOL
  143.     MOVE.L    WarmCapture(A6),D0        ;WarmCapture to d0
  144.     MOVEA.L    #WARM,A0            ;#WARM to a0
  145.     BSR.B    binhex                ;convert Hex to ASCII -=> WARM
  146.     TST.L    Flag                ;is PointerClearFlag set?
  147.     BEQ.B    LeavePointers            ;no: leave Pointers untouched
  148.  
  149.     CLR.L    ColdCapture(A6)            ;clear ColdCapture
  150.     CLR.L    CoolCapture(A6)            ;clear CoolCapture
  151.     CLR.L    WarmCapture(A6)            ;clear WarmCapture
  152.     MOVE.L    #Text,D2            ;Textpointer to d2
  153.     MOVE.L    #Length1,D3            ;Textlength to d3
  154.     BSR.B    TextOutPut            ;output Text
  155.     BRA.B    CloseDos            ;close Doslibrary
  156.  
  157. LeavePointers:
  158.     MOVE.L    #Text,D2            ;Textpointer to d2
  159.     MOVE.L    #Length,D3            ;Textlength to d3
  160.     BSR.B    TextOutPut            ;output Text
  161.     MOVEA.L    ExecBase,A6            ;ExecBase to a6
  162.     MOVE.L    ColdCapture(A6),D0        ;ColdCapture to d0
  163.     OR.L    CoolCapture(A6),D0        ;+ CoolCapture
  164.     OR.L    WarmCapture(A6),D0        ;+ WarmCapture
  165.     TST.L    D0                ;Pointers clean?
  166.     BEQ.B    CloseDos            ;yes -=> CloseDos
  167.  
  168.     MOVE.L    #Text2,D2            ;Textpointer2 to d2
  169.     MOVE.L    #Length2,D3            ;Textlength2 to d3
  170.     BSR.B    TextOutPut            ;output Text2
  171.  
  172. CloseDos:
  173.     MOVEA.L    DOSBase,A1            ;DOSBase to a1
  174.     MOVEA.L    ExecBase,A6            ;ExecBase to a6
  175.     JSR    CloseLibrary(A6)        ;close DOSlibrary
  176.  
  177. ErrorExit:
  178.     RTS                    ;get back to CLI
  179.  
  180. TextOutPut:
  181.     MOVE.L    stdout,D1            ;stdout to d1
  182.     MOVEA.L    DOSBase,A6            ;DOSBase to a6
  183.     JSR    Write(A6)            ;output Text
  184.     RTS
  185.  
  186. ;***********************************************************************
  187. ;*
  188. ;*     binhex
  189. ;*        (c) by Larry Phillips (CIS -76703,4322)
  190. ;*         modified by Heiko Rath to suit better my needs (4.1.88)
  191. ;*
  192. ;* PURPOSE: Convert a binary value in a register to 
  193. ;*       a hex ASCII string at the destination address
  194. ;*          
  195. ;* ROUTINE TYPE: SUBROUTINE
  196. ;*
  197. ;* SYNTAX: bsr    binhex    (source(long),destination) (d0.l,a0)
  198. ;*       bsr    binhexw    (source(word),destination) (d0.w,a0)
  199. ;*       bsr    binhexb    (source(byte),destination) (d0.b,a0)
  200. ;*
  201. ;* ENTRY CONDITIONS: None
  202. ;*
  203. ;* RETURNS: ASCII string in destination address
  204. ;*
  205. ;* NOTE: destination is 8 bytes long to hold string
  206. ;*       for any length (long, word, byte).
  207. ;*       Destination contains result padded with leading zeros.
  208. ;*
  209. ;* CHANGED: Nothing
  210. ;*
  211. ;* USAGE:
  212. ;*
  213. ;*     move    #label,d0
  214. ;*     move.l    address,a0    ;converts the address at label to
  215. ;*     bsr    binhex        ;string at address
  216. ;*                
  217. ;*     move    label,d0
  218. ;*     move.l    address,a0
  219. ;*     bsr    binhex        ;conv contents at label
  220. ;*
  221. ;*     move    #value,d0
  222. ;*     move.l    address,a0
  223. ;*     bsr    binhex        ;convert immediate value
  224. ;*
  225. ;****************************************************************
  226.  
  227. binhex:
  228.     MOVE.L    A0,-(A7)
  229.     MOVE.L    D2,-(A7)            ;preserve d2
  230.     MOVE.L    #$7,D2                ;count to d2
  231.     CLR.L    D1                ;conversion work register
  232.  
  233. bhloop:
  234.     ROL.L    #$4,D0                ;get high order nybble to low order
  235.     MOVE.B    D0,D1                ;low order byte to d1
  236.     ANDI.B    #$F,D1                ;isolate low order byte
  237.     CMPI.B    #$A,D1                ;digit or letter?
  238.     BLT.B    bhaddz                ;branch if digit
  239.     ADDQ.B    #$7,D1                ;offset for letters
  240.  
  241. bhaddz:
  242.     ADDI.B    #'0',D1                ;convert to ASCII
  243.     MOVE.B    D1,(A0)+            ;store it and increment address
  244.     DBF    D2,bhloop            ;do 8 times
  245.  
  246.     MOVE.L    (A7)+,D2            ;restore d2
  247.     MOVEA.L    (A7)+,A0            ;restore a0
  248.     RTS
  249.  
  250. ;
  251. ; Variables:
  252. ;
  253. DOSBase:
  254.     dc.l    0
  255. stdout:
  256.     dc.l    0
  257. Flag:
  258.     dc.l    0
  259. ;
  260. ; Constants:
  261. ;
  262. DOSNAME:
  263.     dc.b    'dos.library',0
  264. Text:
  265.     dc.b    $9b,'0;33;40m','AntiVirus',$9b,'0;31;40m'
  266.     dc.b    '  by  ',$9b,'0;32;40m','Heiko Rath',$9b,'0;31;40m',10
  267.     dc.b    $9b,'4;31;40m',169,' by '
  268.     dc.b    $9b,'1;31;40m','The Software Brewery',$9b,'0;31;40m',10
  269.     dc.b    'ColdCapture:    $'
  270.     cnop    0,2
  271. COLD    dc.b    '00000000',10
  272.     dc.b    'CoolCapture:    $'
  273.     cnop    0,2
  274. COOL    dc.b    '00000000',10
  275.     dc.b    'WarmCapture:    $'
  276.     cnop    0,2
  277. WARM    dc.b    '00000000',10
  278. Length    equ    *-Text
  279.  
  280.     dc.b    'All done - vectors cleared',10
  281. Length1    equ    *-Text
  282.  
  283. Text2:
  284.     dc.b    'To clear the pointers use '
  285.     dc.b    $9b,'1;33;40m','AntiVirus c',$9b,'0;31;40m',10
  286. Length2    equ    *-Text2
  287.  
  288.     end
  289.